t=linspace(0,1,1000);
y= square(2*pi*t,50);
plot(t,y);
xlabel('t');
ylabel('y');
ylim([-1.5,1.5]);
title('A periodic rectangular pulse signal with an amplitude of 1, a period of 1, and a duty cycle of 0.5');
grid on;